package com.chexiehui.jc.widget;

import android.content.Context;
import android.support.annotation.NonNull;
import android.widget.TextView;

import com.chexiehui.jc.R;
import com.lxj.xpopup.core.AttachPopupView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

public class ReportBubblePopup extends AttachPopupView {

    @BindView(R.id.tv_report)
    TextView tvReport;
    private Unbinder mUnBinder;
    private IReportBubblePopupListener listener;

    public ReportBubblePopup(@NonNull Context context) {
        super(context);
    }

    @Override
    protected int getImplLayoutId() {
        return R.layout.layout_report_bubble;
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        mUnBinder = ButterKnife.bind(this);
    }

    @OnClick(R.id.tv_report)
    public void onViewClicked() {
        if (listener != null) {
            listener.onClickReport();
        }
        dismiss();
    }

    public ReportBubblePopup setListener(IReportBubblePopupListener listener) {
        this.listener = listener;
        return this;

    }

    public interface IReportBubblePopupListener {
        void onClickReport();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        if (mUnBinder != null) {
            mUnBinder.unbind();
        }
    }
}
